package com.hsxxherp.ation.business.user.center.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.google.common.base.Objects;
import com.hsxxherp.ation.common.utils.BeanUtils;
import com.hsxxherp.ation.common.utils.json.AtionGsonBuilder;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;

/**
 * <p>
 *
 * </p>
 *
 * @author Baomidou
 * @since 2024-06-16
 */
@Component
@TableName("uc_user")
public class UcUserEntity extends Model<UcUserEntity> implements Serializable {
    public static final String PK_USER = "pk_user";
    public static final String USER_CODE = "user_code";
    public static final String USER_NAME = "user_name";
    public static final String PASSWORD = "password";
    public static final String TYPE = "type";
    public static final String DR = "dr";
    public static final String TS = "ts";
    public static final String EMAIL = "email";
    public static final String MOBILE = "mobile";
    private static final long serialVersionUID = 1L;

    // setter

    /**
     * 用户主键
     */
    @TableId("pk_user")
    private String pkUser;
    /**
     * 用户编码
     */
    private String userCode;
    /**
     * 用户名
     */
    private String userName;
    /**
     * 密码
     */
    private String password;
    /**
     * 用户级别
     */
    private Double type;
    /**
     * 删除标识
     */
    private Double dr;
    /**
     * 数据版本号
     */
    @Version
    private Timestamp ts;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 手机
     */
    private String mobile;

    // getter
    public String getPkUser() {
        return pkUser;
    }

    public void setPkUser(String pkUser) {
        this.pkUser = pkUser;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Double getType() {
        return type;
    }


    // setter

    public void setType(Double type) {
        this.type = type;
    }

    public Double getDr() {
        return dr;
    }

    public void setDr(Double dr) {
        this.dr = dr;
    }

    public Timestamp getTs() {
        return ts;
    }

    public void setTs(Timestamp ts) {
        this.ts = ts;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    @Override
    public String toString() {
        return AtionGsonBuilder.create().toJson(this);
    }

    @Override
    public boolean equals(Object object) {
        return Objects.equal(this, object);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(this);
    }

    /**
     * 转换map
     * @param map
     * @return
     */
    public UcUserEntity  mapToObject(Map<String, Object> map) {
        BeanUtils.mapToObject(map,this);

        return this;
    }
}
